package com.fengxu.springcloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableEurekaClient
// 开启熔断器注解
@EnableCircuitBreaker
public class CloudProviderHystrix8001 {

    public static void main(String[] args) {
        SpringApplication.run(CloudProviderHystrix8001.class,args);
    }

    // @Bean
    public ServletRegistrationBean hystrixDashboardStreamServlet(){
        ServletRegistrationBean servletBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        servletBean.addUrlMappings("/actuator/hystrix.stream");
        return servletBean;
    }
}
